package com.lcxw.hxzbapi.dao.mapper;

import com.lcxw.hxzbapi.entity.pojo.Robot;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface RobotMapper {

    @Delete({
        "delete from ywpd_robots",
        "where `id` = #{id}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into ywpd_robots (`id`, `nickName`, ",
        "`sex`, `age`, `faceUrl`,word)",
        "values (#{id}, #{nickname}, ",
        "#{sex}, #{age}, #{faceUrl}, #{word})"
    })
    int insert(Robot robot);

    @Select({
        "select",
        "*",
        "from ywpd_robots",
        "where `id` = #{id}"
    })
    Robot selectByPrimaryKey(Integer id);

    @Select({
        "select",
        "*",
        "from ywpd_robots"
    })
    List<Robot> selectAll();

    @Update({
        "update ywpd_robots",
        "set `nickName` = #{nickname},",
        "`sex` = #{sex},",
        "`age` = #{age},",
        "`faceUrl` = #{faceUrl}",
        "`word` = #{word}",
        "where `id` = #{id}"
    })
    int updateByPrimaryKey(Robot robot);

}
